#include "yaml.h"

// 初始化 parser 对象
int yaml_parser_initialize(yaml_parser_t *parser){
    parser->str_doc = cstr_init("", BUFFER_INITIAL_SIZE);
    return 1;
}

void yaml_parser_delete(yaml_parser_t *parser){
    cstr_free(parser->str_doc);
}

// 载入 file 并关联 parser 对象
void yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file){
    int size = fread(parser->str_doc.start, sizeof(char), BUFFER_INITIAL_SIZE, file);  // cstr_t 需要自动扩展
    _print("Size of fread() : %d", size);
    assert(!ferror(file));
}

int yaml_parser_load(yaml_parser_t *parser, yaml_document_t *document){

    return 0;
}

// 返回yaml的根节点
yaml_node_t* yaml_document_get_root_node(yaml_document_t *document){

    yaml_node_t* tmp;
    return tmp;
}

void yaml_document_delete(yaml_document_t *document){

}

int yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event){
    
    return 0;
}
